﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace JTicket.UI
{
    public partial class S_SaleProc : System.Web.UI.Page
    {
        private readonly BLL.D_OperInfo bllOper = new BLL.D_OperInfo();
        public List<JTicket.Model.L_SaleProc> _SaleProc { get; set; }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.txtBegin.Value = DateTime.Now.ToString("yyy-MM-dd");
                this.txtEnd.Value = DateTime.Now.ToString("yyy-MM-dd");
                Bind();
            }
        }
        void Bind()
        {

            string opercode = string.Empty; int page = 0;
            DateTime bdate = Convert.ToDateTime(string.Format("{0} 00:00:00", this.txtBegin.Value));
            DateTime edate = Convert.ToDateTime(string.Format("{0} 00:00:00", this.txtEnd.Value));
            int pages = 0;
            int len = 300;
            opercode = bllOper.Oper().OperCode;
            if (!string.IsNullOrEmpty(Request.QueryString["page"]))
            {
                page = int.Parse(Request.QueryString["page"]);
            }
            _SaleProc = DAL.L_SaleProc.GetListByOperCode(page, len, ref pages, opercode, bdate, edate);
            ScriptManager.RegisterStartupScript(
               this, typeof(Page), "pages", string.Format("var page={0};var pages={1};", page, pages), true);
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            Bind();
        }

        protected void Button2_Click(object sender, EventArgs e)
        {

        }

        protected void Button3_Click(object sender, EventArgs e)
        {

        }
    }
}